package cn.dyw.cloudmusic.dao;

import cn.dyw.cloudmusic.entity.Lrc;
import org.apache.ibatis.annotations.*;

@Mapper
public interface LrcMapper {
    /**
     */
    @Delete({
        "delete from lrc",
        "where lrc_id = #{lrcId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lrcId);

    /**
     */
    @Insert({
        "insert into lrc (lrc_id, music_id, ",
        "lyric, version)",
        "values (#{lrcId,jdbcType=INTEGER}, #{musicId,jdbcType=VARCHAR}, ",
        "#{lyric,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER})"
    })
    int insert(Lrc record);

    @Insert({
            "insert into lrc (music_id, ",
            "lyric, version)",
            "values (#{id,jdbcType=VARCHAR}, ",
            "#{lrc.lyric,jdbcType=VARCHAR}, #{lrc.version,jdbcType=INTEGER})"
    })
    int insertVo(@Param("lrc") cn.dyw.cloudmusic.music.vo.Lrc lrc, @Param("id") String id);

    /**
     */
    int insertSelective(Lrc record);

    /**
     */
    @Select({
        "select",
        "lrc_id, music_id, lyric, version",
        "from lrc",
        "where lrc_id = #{lrcId,jdbcType=INTEGER}"
    })
    @ResultMap("cn.dyw.cloudmusic.dao.LrcMapper.BaseResultMap")
    Lrc selectByPrimaryKey(Integer lrcId);

    /**
     */
    int updateByPrimaryKeySelective(Lrc record);

    /**
     */
    @Update({
        "update lrc",
        "set music_id = #{musicId,jdbcType=VARCHAR},",
          "lyric = #{lyric,jdbcType=VARCHAR},",
          "version = #{version,jdbcType=INTEGER}",
        "where lrc_id = #{lrcId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Lrc record);
}